Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workaround for #327 #328

Merged
merged 5 commits into from
Jul 12, 2017
Merged

Added workaround for #327 #328

merged 5 commits into from
Jul 12, 2017

Conversation

TheCelavi
Copy link
Contributor

@TheCelavi TheCelavi commented Jul 9, 2017

As discussed, here is the pull request with Doctrine entities weaving workaround. (see #327)

  • Added doctrine listener that will correct generated metadata
  • Added tests (sorry, no 100% code coverage, method getTraits is private, so it would be very hard to provide it. In original library, code has 100% code coverage, but I didn't wanted to add more dependencies)
  • Modified README.md, added section about this issue and support

TODO:

  • Add support for Symfony' bundle: Event subscriber will be always disabled by default (in order to improve performance). When it is enabled, compiler pass will check if there is a Doctrine ORM enabled in Symfony project, and if there is, it will register event subscriber.

*/
$metadata = $args->getClassMetadata();

if (1 === preg_match(sprintf('/.+(%s)$/', AspectContainer::AOP_PROXIED_SUFFIX), $metadata->name)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 newline after opening brace; 2 found

{
$traits = $this->getTraits($metadata->name);

foreach ($traits as $trait) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 newline after opening brace; 2 found

/**
* @var \ReflectionProperty $property
*/
foreach ($trait->getProperties() as $property) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 newline after opening brace; 2 found

/**
* @var ClassMetadata $metadata
*/
foreach ($metadatas as $metadata) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 newline after opening brace; 2 found

}
}

trait SimpleTrait

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each class must be in a file by itself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not fix this, except to pull out to separate files - however, this class is used only for this test suite, so usual practice is to place it inline within test suite.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can ignore this, ok

class Entity__AopProxied
{
use SimpleTrait;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 blank line at end of file; 2 found

}


class Entity__AopProxied
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not fix this, except to pull out to separate files - however, this class is used only for this test suite, so usual practice is to place it inline within test suite.

Class name must stay same, that is clear.

*
* Support for weaving Doctrine entities.
*
* @package Go\Bridge\Doctrine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, drop this auto-generated tag.

$metadata->isMappedSuperclass = true;
$metadata->isEmbeddedClass = false;
$metadata->table = [];
$metadata->customRepositoryClassName = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have variables aligned.

@goaop goaop deleted a comment from Nitpick-CI Jul 11, 2017
}


class Entity__AopProxied

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Each trait must be in a file by itself
  • Class name Entity__AopProxied is not in camel caps format

private $mappedField;
}

class Entity__AopProxied

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Each trait must be in a file by itself
  • Class name Entity__AopProxied is not in camel caps format

@lisachenko lisachenko merged commit 6e2a0fe into goaop:master Jul 12, 2017
@lisachenko
Copy link
Member

Squashed and merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants